Basic uniSWF AS3 API

Please note this feature requires uniSWF 1.0.3 or above.

uniSWF provides a simple timeline api for controlling flash movies and unity specific commands, this is not a full AS3 implementation so any general scripting such as variables/conditionals are not supported. To use the the as3 api you will need to include fluidlayout.swc which is located 'uniSWF/Examples/common/as3'

Setup

Add ' fluidlayout.swc' like in the screenshot to your FLA.

Timeline control

Add 'uniSWF.stop()' to the frame action to stop the frame. Please note this api only has a limited scope and will only work for the containing movieclip.

Other supported actions are:

uniSWF.gotoAndStop( frameOrLabel );

uniSWF.gotoAndPlay( frameOrLabel );

Flash emulation

A limitation with the api is the flash player doesn't know how to stop the frame, for a better flash preview add the following to stop the movieclip in flash and in unity.


uniSWF.stop(); this.stop();

Playing sound

The uniSWF AS3 API provides a simple sound trigger to load audio from the Resources folder of the Unity project.

Copy any audio clips to the /Resources folder inside the Unity project.


Add a SoundManager provided by the uniSWF library to a new game object and name it 'SoundManager'


Add the following line to trigger an audio clip using the resource path as the first parameter eg. uniSWF.playSound( "audio/PlasmaRifle" );

Add the movieclip to the scene and when the frame script is run the audio should trigger.


Links

Fluid layouts AS docs